package cn.tedu.luban.order.main.consumer;

import cn.tedu.luban.order.main.service.OrderService;
import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
import org.apache.rocketmq.spring.core.RocketMQListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@RocketMQMessageListener(
        topic = "order_delay_topic",
        consumerGroup = "delay_consumer"
)
@Component
public class OrderDelayConsumer implements RocketMQListener<String> {

    @Autowired
    private OrderService orderService;

    @Override
    public void onMessage(String orderNo) {
        try {
            orderService.orderDelay(orderNo);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
